Skip to content

Conversation

@bkonyi
Copy link
Contributor

@bkonyi bkonyi commented Jan 13, 2021

The network profiler was assuming that a response body would only ever
consist of a single chunk. This was resulting in us trying to decode a
partial response, causing a FormatException to be thrown and halting
processing of HTTP events.

This change stitches together all of the response body events for a
given response before trying to decode it. In addition, the
FormatException is caught and ignored in order to allow for non-UTF8
responses.

Fixes both #2398 and #2480

The network profiler was assuming that a response body would only ever
consist of a single chunk. This was resulting in us trying to decode a
partial response, causing a FormatException to be thrown and halting
processing of HTTP events.

This change stitches together all of the response body events for a
given response before trying to decode it. In addition, the
FormatException is caught and ignored in order to allow for non-UTF8
responses.

Fixes both #2398 and #2480
@bkonyi bkonyi requested a review from kenzieschmoll January 13, 2021 00:51
try {
responseBody = utf8.decode(encodedData);
} on FormatException {
// Non-UTF8 response.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we do something to handle non UTF8 responses so that the user has some indication that we did receive a response? What is an example of a non-utf8 response?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An image is an example of a non-UTF8 response. If we try and decode that, it's certain to blow up.

@bkonyi bkonyi merged commit 0dff44e into master Jan 13, 2021
@bkonyi bkonyi deleted the fix_network_profiler_large_response branch January 13, 2021 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants